package uit.shoeshop.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;

import com.opensymphony.xwork2.ActionSupport;

import uit.shoeshop.dto.SlideshowDTO;
import uit.shoeshop.model.SlideshowModel;

import java.util.ArrayList;

public class SlideshowAction extends ActionSupport implements ServletRequestAware,ServletResponseAware{
	private static final long serialVersionUID = 1L;
	private HttpServletRequest request;
	private HttpServletResponse response;

	private ArrayList<SlideshowDTO> slideshowEvent;
	
	@Override
	public void setServletRequest(HttpServletRequest request) {
		this.request = request;
	}

	@Override
	public void setServletResponse(HttpServletResponse response) {
		this.response = response;
	}
	
    public String execute() throws Exception {
    	SlideshowModel slideshow = new SlideshowModel();
    	try{
    		setSlideshowEvent(slideshow.getAllEvent());
    	}catch(Exception e){
    		return ERROR;
    	}finally{
    		slideshow = null;
    	}
    	
        return SUCCESS;
    }

	public void setSlideshowEvent(ArrayList<SlideshowDTO> slideshowEvent) {
		this.slideshowEvent = slideshowEvent;
	}

	public ArrayList<SlideshowDTO> getSlideshowEvent() {
		return slideshowEvent;
	}


}
